# -*- coding: utf-8 -*-
# @Time    : 2023/2/7 13:53
# @Author  : kali
import pytz
from flask_apscheduler import APScheduler

from spider import tags_spider, tags_detail_spider

scheduler = APScheduler()


@scheduler.task(
    trigger='cron',  # 触发方式，定时
    id='tags_task',  # 任务id
    day='*',  # 每天
    hour='1',  # 凌晨1:00:00点执行任务
    minute='0',
    second='0',
    timezone=pytz.utc  # 解决pytz警告信息
)
def tags_task():
    """
    定时采集标签数据
    :return:
    """
    tags_spider()


@scheduler.task(
    trigger='cron',
    id='tags_detail_task',
    day='*',
    hour='3',
    minute='0',
    second='0',
    timezone=pytz.utc
)
def tags_detail_task():
    """
    定时采集标签详情数据
    :return:
    """
    tags_detail_spider()
